Change in openvpn[master]: Deprecate --fast-io option
A message that is not in the archive (sent off-list or not yet received): gerrit.1765279409000.I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
to review the following change.
Change subject: Deprecate --fast-io option
......................................................................
Deprecate --fast-io option
Recent changes to the event loop revealed that
the --fast-io option is now partially broken and
may cause "unroutable control packet" issues.
As agreed during the last hackathon, this patch
turns --fast-io into a no-op and emits a warning
when it is used.
---
M doc/man-sections/generic-options.rst
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/mudp.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
8 files changed, 11 insertions(+), 109 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/1425/1
doc/man-sections/generic-options.rst +1 -1
@@ -212,7 +212,7 @@ are supported by OpenSSL. --fast-io - Optimize TUN/TAP/UDP I/O writes by avoiding a call to + **DEPRECATED** Optimize TUN/TAP/UDP I/O writes by avoiding a call to poll/epoll/select prior to the write operation. The purpose of such a call would normally be to block until the device or socket is ready to accept the write. Such blocking is unnecessary on some platforms which
src/openvpn/forward.c +7 -29
@@ -2154,13 +2154,12 @@ }/* -* Wait for I/O events. Used for both TCP & UDP sockets -* in point-to-point mode and for UDP sockets in +* Wait for I/O events. Used for UDP sockets in * point-to-multipoint mode. */ void -get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) +get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) {unsigned int out_socket;
@@ -2168,33 +2167,12 @@ multi_io->udp_flags = (out_socket <<SOCKET_SHIFT ); } +/* +* This is the core I/O wait function, used for all I/O waits except +* for the top-level server sockets. +*/ void -get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) -{ - multi_io->udp_flags =ES_ERROR ; -if (c->c2.fast_io && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - multi_io->udp_flags = ret; - } -else - { -/* slow path - delegate to io_wait_dowork_udp to calculate flags */ -get_io_flags_dowork_udp (c, multi_io, flags); - } -} - -void -io_wait_dowork (struct context *c,const unsigned int flags) +io_wait (struct context *c,const unsigned int flags) {unsigned int out_socket;unsigned int out_tuntap;
src/openvpn/forward.h +1 -32
@@ -68,12 +68,9 @@extern counter_type link_write_bytes_global; -void get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io, -const unsigned int flags); -void get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags); -void io_wait_dowork (struct context *c,const unsigned int flags); +void io_wait (struct context *c,const unsigned int flags);void pre_select (struct context *c);
@@ -382,34 +379,6 @@return flags; } -/* -* This is the core I/O wait function, used for all I/O waits except -* for the top-level server sockets. -*/ -static inline void -io_wait (struct context *c,const unsigned int flags) -{ -if (proto_is_dgram (c->c2.link_sockets[0 ]->info.proto) && c->c2.fast_io - && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - c->c2.event_set_status = ret; - } -else - { -/* slow path */ -io_wait_dowork (c, flags); - } -}static inline bool connection_established (struct context *c)
src/openvpn/init.c +0 -34
@@ -4139,34 +4139,6 @@ } } -/* -* Fast I/O setup. Fast I/O is an optimization which only works -* if all of the following are true: -* -* (1) The platform is not Windows -* (2) --proto udp is enabled -* (3) --shaper is disabled -*/ -static void -do_setup_fast_io (struct context *c) -{ -if (c->options.fast_io) - { -#ifdef _WIN32 -msg (M_INFO ,"NOTE: --fast-io is disabled since we are running on Windows" ); -#else -if (c->options.shaper) - { -msg (M_INFO ,"NOTE: --fast-io is disabled since we are using --shaper" ); - } -else - { - c->c2.fast_io = true; - } -#endif - } -} -static void do_signal_on_tls_errors (struct context *c) {
@@ -4513,12 +4485,6 @@ }#endif -/* should we enable fast I/O? */ -if (c->mode ==CM_P2P || c->mode ==CM_TOP ) - { -do_setup_fast_io (c); - } -/* should we throw a signal on TLS errors? */ do_signal_on_tls_errors (c);
src/openvpn/mudp.c +1 -3
@@ -339,9 +339,7 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock) {const unsigned int status = m->multi_io->udp_flags; -const unsigned int mpp_flags = m->top.c2.fast_io - ? (MPP_CONDITIONAL_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ) - : (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +const unsigned int mpp_flags = (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL );/* UDP port ready to accept write */ if (status &SOCKET_WRITE )
src/openvpn/openvpn.h +0 -3
@@ -420,9 +420,6 @@struct env_set *es;bool es_owned; -/* don't wait for TUN/TAP/UDP to be ready to accept write */ -bool fast_io; -/* --ifconfig endpoints to be pushed to client */ bool push_request_received;bool push_ifconfig_defined;
src/openvpn/options.c +1 -4
@@ -285,7 +285,6 @@#if ENABLE_IP_PKTINFO "--multihome : Configure a multi-homed UDP server.\n"#endif -"--fast-io : Optimize TUN/TAP/UDP writes.\n" "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n" "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
@@ -1795,8 +1794,6 @@#endif SHOW_INT (sockflags); -SHOW_BOOL (fast_io); -SHOW_INT (comp.alg);SHOW_INT (comp.flags);
@@ -6600,7 +6597,7 @@else if (streq (p[0 ],"fast-io" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL ); - options->fast_io = true; +msg (M_WARN ,"DEPRECATED: --fast-io option ignored. " ); }else if (streq (p[0 ],"inactive" ) && p[1 ] && !p[3 ]) {
src/openvpn/options.h +0 -3
@@ -406,9 +406,6 @@int status_file_version;int status_file_update_freq; -/* optimize TUN/TAP/UDP writes */ -bool fast_io; -struct compress_options comp;/* buffer sizes */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: its_Giaan, plaisthos.
flichtenheld has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Patch Set 1: Code-Review-1
(1 comment)
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/1425/comment/aac4015e_6f38dfd0?usp=email :
PS1, Line 6600: msg(M_WARN, "DEPRECATED: --fast-io option ignored. ");
Most warnings use DEPRECATED OPTION: so please use that for consistency.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Comment-Date: Tue, 09 Dec 2025 11:31:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: flichtenheld, its_Giaan, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Deprecate --fast-io option
......................................................................
Deprecate --fast-io option
Recent changes to the event loop revealed that
the --fast-io option is now partially broken and
may cause "unroutable control packet" issues.
As agreed during the last hackathon, this patch
turns --fast-io into a no-op and emits a warning
when it is used.
---
M doc/man-sections/generic-options.rst
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/mudp.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
8 files changed, 11 insertions(+), 109 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/1425/2
doc/man-sections/generic-options.rst +1 -1
@@ -212,7 +212,7 @@ are supported by OpenSSL. --fast-io - Optimize TUN/TAP/UDP I/O writes by avoiding a call to + **DEPRECATED** Optimize TUN/TAP/UDP I/O writes by avoiding a call to poll/epoll/select prior to the write operation. The purpose of such a call would normally be to block until the device or socket is ready to accept the write. Such blocking is unnecessary on some platforms which
src/openvpn/forward.c +7 -29
@@ -2154,13 +2154,12 @@ }/* -* Wait for I/O events. Used for both TCP & UDP sockets -* in point-to-point mode and for UDP sockets in +* Wait for I/O events. Used for UDP sockets in * point-to-multipoint mode. */ void -get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) +get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) {unsigned int out_socket;
@@ -2168,33 +2167,12 @@ multi_io->udp_flags = (out_socket <<SOCKET_SHIFT ); } +/* +* This is the core I/O wait function, used for all I/O waits except +* for the top-level server sockets. +*/ void -get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) -{ - multi_io->udp_flags =ES_ERROR ; -if (c->c2.fast_io && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - multi_io->udp_flags = ret; - } -else - { -/* slow path - delegate to io_wait_dowork_udp to calculate flags */ -get_io_flags_dowork_udp (c, multi_io, flags); - } -} - -void -io_wait_dowork (struct context *c,const unsigned int flags) +io_wait (struct context *c,const unsigned int flags) {unsigned int out_socket;unsigned int out_tuntap;
src/openvpn/forward.h +1 -32
@@ -68,12 +68,9 @@extern counter_type link_write_bytes_global; -void get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io, -const unsigned int flags); -void get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags); -void io_wait_dowork (struct context *c,const unsigned int flags); +void io_wait (struct context *c,const unsigned int flags);void pre_select (struct context *c);
@@ -382,34 +379,6 @@return flags; } -/* -* This is the core I/O wait function, used for all I/O waits except -* for the top-level server sockets. -*/ -static inline void -io_wait (struct context *c,const unsigned int flags) -{ -if (proto_is_dgram (c->c2.link_sockets[0 ]->info.proto) && c->c2.fast_io - && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - c->c2.event_set_status = ret; - } -else - { -/* slow path */ -io_wait_dowork (c, flags); - } -}static inline bool connection_established (struct context *c)
src/openvpn/init.c +0 -34
@@ -4139,34 +4139,6 @@ } } -/* -* Fast I/O setup. Fast I/O is an optimization which only works -* if all of the following are true: -* -* (1) The platform is not Windows -* (2) --proto udp is enabled -* (3) --shaper is disabled -*/ -static void -do_setup_fast_io (struct context *c) -{ -if (c->options.fast_io) - { -#ifdef _WIN32 -msg (M_INFO ,"NOTE: --fast-io is disabled since we are running on Windows" ); -#else -if (c->options.shaper) - { -msg (M_INFO ,"NOTE: --fast-io is disabled since we are using --shaper" ); - } -else - { - c->c2.fast_io = true; - } -#endif - } -} -static void do_signal_on_tls_errors (struct context *c) {
@@ -4513,12 +4485,6 @@ }#endif -/* should we enable fast I/O? */ -if (c->mode ==CM_P2P || c->mode ==CM_TOP ) - { -do_setup_fast_io (c); - } -/* should we throw a signal on TLS errors? */ do_signal_on_tls_errors (c);
src/openvpn/mudp.c +1 -3
@@ -339,9 +339,7 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock) {const unsigned int status = m->multi_io->udp_flags; -const unsigned int mpp_flags = m->top.c2.fast_io - ? (MPP_CONDITIONAL_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ) - : (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +const unsigned int mpp_flags = (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL );/* UDP port ready to accept write */ if (status &SOCKET_WRITE )
src/openvpn/openvpn.h +0 -3
@@ -420,9 +420,6 @@struct env_set *es;bool es_owned; -/* don't wait for TUN/TAP/UDP to be ready to accept write */ -bool fast_io; -/* --ifconfig endpoints to be pushed to client */ bool push_request_received;bool push_ifconfig_defined;
src/openvpn/options.c +1 -4
@@ -285,7 +285,6 @@#if ENABLE_IP_PKTINFO "--multihome : Configure a multi-homed UDP server.\n"#endif -"--fast-io : Optimize TUN/TAP/UDP writes.\n" "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n" "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
@@ -1795,8 +1794,6 @@#endif SHOW_INT (sockflags); -SHOW_BOOL (fast_io); -SHOW_INT (comp.alg);SHOW_INT (comp.flags);
@@ -6600,7 +6597,7 @@else if (streq (p[0 ],"fast-io" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL ); - options->fast_io = true; +msg (M_WARN ,"DEPRECATED OPTION: --fast-io option ignored. " ); }else if (streq (p[0 ],"inactive" ) && p[1 ] && !p[3 ]) {
src/openvpn/options.h +0 -3
@@ -406,9 +406,6 @@int status_file_version;int status_file_update_freq; -/* optimize TUN/TAP/UDP writes */ -bool fast_io; -struct compress_options comp;/* buffer sizes */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
its_Giaan has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Patch Set 2:
(1 comment)
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/1425/comment/f47786ff_81c645e4?usp=email :
PS1, Line 6600: msg(M_WARN, "DEPRECATED: --fast-io option ignored. ");
Quoted 1 line
Most warnings use
DEPRECATED OPTION:so please use that for consistency.
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 09 Dec 2025 12:03:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Attention is currently required from: its_Giaan, plaisthos.
flichtenheld has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Patch Set 2: Code-Review-1
(1 comment)
File doc/man-sections/generic-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1425/comment/6c719c88_f7491c74?usp=email :
PS2, Line 215: **DEPRECATED** Optimize TUN/TAP/UDP I/O writes by avoiding a call to
We should remove this whole explanation. Since the option is now an no-op, it doesn't make sense to keep it. For options that are a no-op, the most common solution seems to be to add a short note in unsupported-options.rst.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Comment-Date: Tue, 09 Dec 2025 12:30:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: flichtenheld, its_Giaan, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Deprecate --fast-io option
......................................................................
Deprecate --fast-io option
Recent changes to the event loop revealed that
the --fast-io option is now partially broken and
may cause "unroutable control packet" issues.
As agreed during the last hackathon, this patch
turns --fast-io into a no-op and emits a warning
when it is used.
---
M doc/man-sections/generic-options.rst
M doc/man-sections/unsupported-options.rst
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/mudp.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
9 files changed, 14 insertions(+), 120 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/1425/3
doc/man-sections/generic-options.rst +0 -12
@@ -211,18 +211,6 @@ ``--show-engines`` standalone option to list the crypto engines which are supported by OpenSSL. ---fast-io - Optimize TUN/TAP/UDP I/O writes by avoiding a call to - poll/epoll/select prior to the write operation. The purpose of such a - call would normally be to block until the device or socket is ready to - accept the write. Such blocking is unnecessary on some platforms which - don't support write blocking on UDP sockets or TUN/TAP devices. In such - cases, one can optimize the event loop by avoiding the poll/epoll/select - call, improving CPU efficiency by 5% to 10%. - - This option can only be used on non-Windows systems, when ``--proto - udp`` is specified, and when ``--shaper`` is *NOT* specified. - --group group Similar to the ``--user`` option, this option changes the group ID of the OpenVPN process to ``group`` after initialization.
doc/man-sections/unsupported-options.rst +4 -0
@@ -49,3 +49,7 @@ --opt-verify Removed in OpenVPN 2.7. This option does not make sense anymore as option strings may not match due to the introduction of parameters negotiation. + +--fast-io + Ignored since OpenVPN 2.7. This option became broken with latest changes + to the event loop.
src/openvpn/forward.c +7 -29
@@ -2154,13 +2154,12 @@ }/* -* Wait for I/O events. Used for both TCP & UDP sockets -* in point-to-point mode and for UDP sockets in +* Wait for I/O events. Used for UDP sockets in * point-to-multipoint mode. */ void -get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) +get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) {unsigned int out_socket;
@@ -2168,33 +2167,12 @@ multi_io->udp_flags = (out_socket <<SOCKET_SHIFT ); } +/* +* This is the core I/O wait function, used for all I/O waits except +* for the top-level server sockets. +*/ void -get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) -{ - multi_io->udp_flags =ES_ERROR ; -if (c->c2.fast_io && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - multi_io->udp_flags = ret; - } -else - { -/* slow path - delegate to io_wait_dowork_udp to calculate flags */ -get_io_flags_dowork_udp (c, multi_io, flags); - } -} - -void -io_wait_dowork (struct context *c,const unsigned int flags) +io_wait (struct context *c,const unsigned int flags) {unsigned int out_socket;unsigned int out_tuntap;
src/openvpn/forward.h +1 -32
@@ -68,12 +68,9 @@extern counter_type link_write_bytes_global; -void get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io, -const unsigned int flags); -void get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags); -void io_wait_dowork (struct context *c,const unsigned int flags); +void io_wait (struct context *c,const unsigned int flags);void pre_select (struct context *c);
@@ -382,34 +379,6 @@return flags; } -/* -* This is the core I/O wait function, used for all I/O waits except -* for the top-level server sockets. -*/ -static inline void -io_wait (struct context *c,const unsigned int flags) -{ -if (proto_is_dgram (c->c2.link_sockets[0 ]->info.proto) && c->c2.fast_io - && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - c->c2.event_set_status = ret; - } -else - { -/* slow path */ -io_wait_dowork (c, flags); - } -}static inline bool connection_established (struct context *c)
src/openvpn/init.c +0 -34
@@ -4139,34 +4139,6 @@ } } -/* -* Fast I/O setup. Fast I/O is an optimization which only works -* if all of the following are true: -* -* (1) The platform is not Windows -* (2) --proto udp is enabled -* (3) --shaper is disabled -*/ -static void -do_setup_fast_io (struct context *c) -{ -if (c->options.fast_io) - { -#ifdef _WIN32 -msg (M_INFO ,"NOTE: --fast-io is disabled since we are running on Windows" ); -#else -if (c->options.shaper) - { -msg (M_INFO ,"NOTE: --fast-io is disabled since we are using --shaper" ); - } -else - { - c->c2.fast_io = true; - } -#endif - } -} -static void do_signal_on_tls_errors (struct context *c) {
@@ -4513,12 +4485,6 @@ }#endif -/* should we enable fast I/O? */ -if (c->mode ==CM_P2P || c->mode ==CM_TOP ) - { -do_setup_fast_io (c); - } -/* should we throw a signal on TLS errors? */ do_signal_on_tls_errors (c);
src/openvpn/mudp.c +1 -3
@@ -339,9 +339,7 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock) {const unsigned int status = m->multi_io->udp_flags; -const unsigned int mpp_flags = m->top.c2.fast_io - ? (MPP_CONDITIONAL_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ) - : (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +const unsigned int mpp_flags = (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL );/* UDP port ready to accept write */ if (status &SOCKET_WRITE )
src/openvpn/openvpn.h +0 -3
@@ -420,9 +420,6 @@struct env_set *es;bool es_owned; -/* don't wait for TUN/TAP/UDP to be ready to accept write */ -bool fast_io; -/* --ifconfig endpoints to be pushed to client */ bool push_request_received;bool push_ifconfig_defined;
src/openvpn/options.c +1 -4
@@ -285,7 +285,6 @@#if ENABLE_IP_PKTINFO "--multihome : Configure a multi-homed UDP server.\n"#endif -"--fast-io : Optimize TUN/TAP/UDP writes.\n" "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n" "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
@@ -1795,8 +1794,6 @@#endif SHOW_INT (sockflags); -SHOW_BOOL (fast_io); -SHOW_INT (comp.alg);SHOW_INT (comp.flags);
@@ -6600,7 +6597,7 @@else if (streq (p[0 ],"fast-io" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL ); - options->fast_io = true; +msg (M_WARN ,"DEPRECATED OPTION: --fast-io option ignored. " ); }else if (streq (p[0 ],"inactive" ) && p[1 ] && !p[3 ]) {
src/openvpn/options.h +0 -3
@@ -406,9 +406,6 @@int status_file_version;int status_file_update_freq; -/* optimize TUN/TAP/UDP writes */ -bool fast_io; -struct compress_options comp;/* buffer sizes */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 3
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
its_Giaan has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Patch Set 3:
(1 comment)
File doc/man-sections/generic-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1425/comment/97eedf9d_7c40861a?usp=email :
PS2, Line 215: **DEPRECATED** Optimize TUN/TAP/UDP I/O writes by avoiding a call to
Quoted 1 line
We should remove this whole explanation. […]
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 3
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 09 Dec 2025 12:48:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Attention is currently required from: its_Giaan, plaisthos.
flichtenheld has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Patch Set 3: Code-Review-1
(3 comments)
File doc/man-sections/unsupported-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1425/comment/e0878cd5_9c32f4ab?usp=email :
PS3, Line 53: --fast-io
The options are alphabetically sorted. Please put it in the right spot.
http://gerrit.openvpn.net/c/openvpn/+/1425/comment/d3d06463_5f63df3e?usp=email :
PS3, Line 54: Ignored since OpenVPN 2.7. This option became broken with latest changes
"latest" feels wrong in this context. How about "This option became broken due to changes to the event loop."?
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/1425/comment/4514d830_40647eb5?usp=email :
PS3, Line 6600: msg(M_WARN, "DEPRECATED OPTION: --fast-io option ignored. ");
Remove superfluous space at the end of the line.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 3
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Comment-Date: Tue, 09 Dec 2025 13:51:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: flichtenheld, its_Giaan, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Deprecate --fast-io option
......................................................................
Deprecate --fast-io option
Recent changes to the event loop revealed that
the --fast-io option is now partially broken and
may cause "unroutable control packet" issues.
As agreed during the last hackathon, this patch
turns --fast-io into a no-op and emits a warning
when it is used.
---
M doc/man-sections/generic-options.rst
M doc/man-sections/unsupported-options.rst
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/mudp.c
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
9 files changed, 15 insertions(+), 121 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/1425/4
doc/man-sections/generic-options.rst +0 -12
@@ -211,18 +211,6 @@ ``--show-engines`` standalone option to list the crypto engines which are supported by OpenSSL. ---fast-io - Optimize TUN/TAP/UDP I/O writes by avoiding a call to - poll/epoll/select prior to the write operation. The purpose of such a - call would normally be to block until the device or socket is ready to - accept the write. Such blocking is unnecessary on some platforms which - don't support write blocking on UDP sockets or TUN/TAP devices. In such - cases, one can optimize the event loop by avoiding the poll/epoll/select - call, improving CPU efficiency by 5% to 10%. - - This option can only be used on non-Windows systems, when ``--proto - udp`` is specified, and when ``--shaper`` is *NOT* specified. - --group group Similar to the ``--user`` option, this option changes the group ID of the OpenVPN process to ``group`` after initialization.
doc/man-sections/unsupported-options.rst +5 -1
@@ -9,6 +9,10 @@ Removed in OpenVPN 2.5. This should be replaxed with ``--verify-client-cert none``. +--fast-io + Ignored since OpenVPN 2.7. This option became broken due to changes + to the event loop. + --ifconfig-pool-linear Removed in OpenVPN 2.5. This should be replaced with ``--topology p2p``.
@@ -48,4 +52,4 @@ --opt-verify Removed in OpenVPN 2.7. This option does not make sense anymore as option - strings may not match due to the introduction of parameters negotiation. + strings may not match due to the introduction of parameters negotiation.
src/openvpn/forward.c +7 -29
@@ -2154,13 +2154,12 @@ }/* -* Wait for I/O events. Used for both TCP & UDP sockets -* in point-to-point mode and for UDP sockets in +* Wait for I/O events. Used for UDP sockets in * point-to-multipoint mode. */ void -get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) +get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) {unsigned int out_socket;
@@ -2168,33 +2167,12 @@ multi_io->udp_flags = (out_socket <<SOCKET_SHIFT ); } +/* +* This is the core I/O wait function, used for all I/O waits except +* for the top-level server sockets. +*/ void -get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) -{ - multi_io->udp_flags =ES_ERROR ; -if (c->c2.fast_io && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - multi_io->udp_flags = ret; - } -else - { -/* slow path - delegate to io_wait_dowork_udp to calculate flags */ -get_io_flags_dowork_udp (c, multi_io, flags); - } -} - -void -io_wait_dowork (struct context *c,const unsigned int flags) +io_wait (struct context *c,const unsigned int flags) {unsigned int out_socket;unsigned int out_tuntap;
src/openvpn/forward.h +1 -32
@@ -68,12 +68,9 @@extern counter_type link_write_bytes_global; -void get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io, -const unsigned int flags); -void get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags); -void io_wait_dowork (struct context *c,const unsigned int flags); +void io_wait (struct context *c,const unsigned int flags);void pre_select (struct context *c);
@@ -382,34 +379,6 @@return flags; } -/* -* This is the core I/O wait function, used for all I/O waits except -* for the top-level server sockets. -*/ -static inline void -io_wait (struct context *c,const unsigned int flags) -{ -if (proto_is_dgram (c->c2.link_sockets[0 ]->info.proto) && c->c2.fast_io - && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - c->c2.event_set_status = ret; - } -else - { -/* slow path */ -io_wait_dowork (c, flags); - } -}static inline bool connection_established (struct context *c)
src/openvpn/init.c +0 -34
@@ -4139,34 +4139,6 @@ } } -/* -* Fast I/O setup. Fast I/O is an optimization which only works -* if all of the following are true: -* -* (1) The platform is not Windows -* (2) --proto udp is enabled -* (3) --shaper is disabled -*/ -static void -do_setup_fast_io (struct context *c) -{ -if (c->options.fast_io) - { -#ifdef _WIN32 -msg (M_INFO ,"NOTE: --fast-io is disabled since we are running on Windows" ); -#else -if (c->options.shaper) - { -msg (M_INFO ,"NOTE: --fast-io is disabled since we are using --shaper" ); - } -else - { - c->c2.fast_io = true; - } -#endif - } -} -static void do_signal_on_tls_errors (struct context *c) {
@@ -4513,12 +4485,6 @@ }#endif -/* should we enable fast I/O? */ -if (c->mode ==CM_P2P || c->mode ==CM_TOP ) - { -do_setup_fast_io (c); - } -/* should we throw a signal on TLS errors? */ do_signal_on_tls_errors (c);
src/openvpn/mudp.c +1 -3
@@ -339,9 +339,7 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock) {const unsigned int status = m->multi_io->udp_flags; -const unsigned int mpp_flags = m->top.c2.fast_io - ? (MPP_CONDITIONAL_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ) - : (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +const unsigned int mpp_flags = (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL );/* UDP port ready to accept write */ if (status &SOCKET_WRITE )
src/openvpn/openvpn.h +0 -3
@@ -420,9 +420,6 @@struct env_set *es;bool es_owned; -/* don't wait for TUN/TAP/UDP to be ready to accept write */ -bool fast_io; -/* --ifconfig endpoints to be pushed to client */ bool push_request_received;bool push_ifconfig_defined;
src/openvpn/options.c +1 -4
@@ -285,7 +285,6 @@#if ENABLE_IP_PKTINFO "--multihome : Configure a multi-homed UDP server.\n"#endif -"--fast-io : Optimize TUN/TAP/UDP writes.\n" "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n" "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
@@ -1795,8 +1794,6 @@#endif SHOW_INT (sockflags); -SHOW_BOOL (fast_io); -SHOW_INT (comp.alg);SHOW_INT (comp.flags);
@@ -6600,7 +6597,7 @@else if (streq (p[0 ],"fast-io" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL ); - options->fast_io = true; +msg (M_WARN ,"DEPRECATED OPTION: --fast-io option ignored." ); }else if (streq (p[0 ],"inactive" ) && p[1 ] && !p[3 ]) {
src/openvpn/options.h +0 -3
@@ -406,9 +406,6 @@int status_file_version;int status_file_update_freq; -/* optimize TUN/TAP/UDP writes */ -bool fast_io; -struct compress_options comp;/* buffer sizes */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 4
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
its_Giaan has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Patch Set 3:
(3 comments)
File doc/man-sections/unsupported-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1425/comment/4124cd87_f4b415ee?usp=email :
PS3, Line 53: --fast-io
Quoted 1 line
The options are alphabetically sorted. Please put it in the right spot.
Done
http://gerrit.openvpn.net/c/openvpn/+/1425/comment/4fcd2867_d74273a7?usp=email :
PS3, Line 54: Ignored since OpenVPN 2.7. This option became broken with latest changes
Quoted 1 line
"latest" feels wrong in this context. […]
Done
File src/openvpn/options.c:
http://gerrit.openvpn.net/c/openvpn/+/1425/comment/34b27d89_4fabdab6?usp=email :
PS3, Line 6600: msg(M_WARN, "DEPRECATED OPTION: --fast-io option ignored. ");
Quoted 1 line
Remove superfluous space at the end of the line.
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 3
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 09 Dec 2025 14:28:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Attention is currently required from: its_Giaan, plaisthos.
flichtenheld has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Patch Set 4: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 4
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Comment-Date: Tue, 09 Dec 2025 14:59:41 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v4 1/1 Deprecate --fast-io option
In reply to a message not in the archiveFrom: Gianmarco De Gregori <[email protected]...>
Recent changes to the event loop revealed that
the --fast-io option is now partially broken and
may cause "unroutable control packet" issues.
As agreed during the last hackathon, this patch
turns --fast-io into a no-op and emits a warning
when it is used.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1425
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1425
This mail reflects revision 4 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
doc/man-sections/generic-options.rst +0 -12
@@ -211,18 +211,6 @@ ``--show-engines`` standalone option to list the crypto engines which are supported by OpenSSL. ---fast-io - Optimize TUN/TAP/UDP I/O writes by avoiding a call to - poll/epoll/select prior to the write operation. The purpose of such a - call would normally be to block until the device or socket is ready to - accept the write. Such blocking is unnecessary on some platforms which - don't support write blocking on UDP sockets or TUN/TAP devices. In such - cases, one can optimize the event loop by avoiding the poll/epoll/select - call, improving CPU efficiency by 5% to 10%. - - This option can only be used on non-Windows systems, when ``--proto - udp`` is specified, and when ``--shaper`` is *NOT* specified. - --group group Similar to the ``--user`` option, this option changes the group ID of the OpenVPN process to ``group`` after initialization.
doc/man-sections/unsupported-options.rst +5 -1
@@ -9,6 +9,10 @@ Removed in OpenVPN 2.5. This should be replaxed with ``--verify-client-cert none``. +--fast-io + Ignored since OpenVPN 2.7. This option became broken due to changes + to the event loop. + --ifconfig-pool-linear Removed in OpenVPN 2.5. This should be replaced with ``--topology p2p``.
@@ -48,4 +52,4 @@ --opt-verify Removed in OpenVPN 2.7. This option does not make sense anymore as option - strings may not match due to the introduction of parameters negotiation. + strings may not match due to the introduction of parameters negotiation.
src/openvpn/forward.c +7 -29
@@ -2154,13 +2154,12 @@ }/* -* Wait for I/O events. Used for both TCP & UDP sockets -* in point-to-point mode and for UDP sockets in +* Wait for I/O events. Used for UDP sockets in * point-to-multipoint mode. */ void -get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) +get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) {unsigned int out_socket;
@@ -2168,33 +2167,12 @@ multi_io->udp_flags = (out_socket <<SOCKET_SHIFT ); } +/* +* This is the core I/O wait function, used for all I/O waits except +* for the top-level server sockets. +*/ void -get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) -{ - multi_io->udp_flags =ES_ERROR ; -if (c->c2.fast_io && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - multi_io->udp_flags = ret; - } -else - { -/* slow path - delegate to io_wait_dowork_udp to calculate flags */ -get_io_flags_dowork_udp (c, multi_io, flags); - } -} - -void -io_wait_dowork (struct context *c,const unsigned int flags) +io_wait (struct context *c,const unsigned int flags) {unsigned int out_socket;unsigned int out_tuntap;
src/openvpn/forward.h +1 -32
@@ -68,12 +68,9 @@extern counter_type link_write_bytes_global; -void get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io, -const unsigned int flags); -void get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags); -void io_wait_dowork (struct context *c,const unsigned int flags); +void io_wait (struct context *c,const unsigned int flags);void pre_select (struct context *c);
@@ -382,34 +379,6 @@return flags; } -/* -* This is the core I/O wait function, used for all I/O waits except -* for the top-level server sockets. -*/ -static inline void -io_wait (struct context *c,const unsigned int flags) -{ -if (proto_is_dgram (c->c2.link_sockets[0 ]->info.proto) && c->c2.fast_io - && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - c->c2.event_set_status = ret; - } -else - { -/* slow path */ -io_wait_dowork (c, flags); - } -}static inline bool connection_established (struct context *c)
src/openvpn/init.c +0 -34
@@ -4139,34 +4139,6 @@ } } -/* -* Fast I/O setup. Fast I/O is an optimization which only works -* if all of the following are true: -* -* (1) The platform is not Windows -* (2) --proto udp is enabled -* (3) --shaper is disabled -*/ -static void -do_setup_fast_io (struct context *c) -{ -if (c->options.fast_io) - { -#ifdef _WIN32 -msg (M_INFO ,"NOTE: --fast-io is disabled since we are running on Windows" ); -#else -if (c->options.shaper) - { -msg (M_INFO ,"NOTE: --fast-io is disabled since we are using --shaper" ); - } -else - { - c->c2.fast_io = true; - } -#endif - } -} -static void do_signal_on_tls_errors (struct context *c) {
@@ -4513,12 +4485,6 @@ }#endif -/* should we enable fast I/O? */ -if (c->mode ==CM_P2P || c->mode ==CM_TOP ) - { -do_setup_fast_io (c); - } -/* should we throw a signal on TLS errors? */ do_signal_on_tls_errors (c);
src/openvpn/mudp.c +1 -3
@@ -339,9 +339,7 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock) {const unsigned int status = m->multi_io->udp_flags; -const unsigned int mpp_flags = m->top.c2.fast_io - ? (MPP_CONDITIONAL_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ) - : (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +const unsigned int mpp_flags = (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL );/* UDP port ready to accept write */ if (status &SOCKET_WRITE )
src/openvpn/openvpn.h +0 -3
@@ -420,9 +420,6 @@struct env_set *es;bool es_owned; -/* don't wait for TUN/TAP/UDP to be ready to accept write */ -bool fast_io; -/* --ifconfig endpoints to be pushed to client */ bool push_request_received;bool push_ifconfig_defined;
src/openvpn/options.c +1 -4
@@ -285,7 +285,6 @@#if ENABLE_IP_PKTINFO "--multihome : Configure a multi-homed UDP server.\n"#endif -"--fast-io : Optimize TUN/TAP/UDP writes.\n" "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n" "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
@@ -1795,8 +1794,6 @@#endif SHOW_INT (sockflags); -SHOW_BOOL (fast_io); -SHOW_INT (comp.alg);SHOW_INT (comp.flags);
@@ -6600,7 +6597,7 @@else if (streq (p[0 ],"fast-io" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL ); - options->fast_io = true; +msg (M_WARN ,"DEPRECATED OPTION: --fast-io option ignored." ); }else if (streq (p[0 ],"inactive" ) && p[1 ] && !p[3 ]) {
src/openvpn/options.h +0 -3
@@ -406,9 +406,6 @@int status_file_version;int status_file_update_freq; -/* optimize TUN/TAP/UDP writes */ -bool fast_io; -struct compress_options comp;/* buffer sizes */
Attention is currently required from: its_Giaan.
plaisthos has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Patch Set 4: Code-Review-1
(1 comment)
Patchset:
PS4:
Did we ever benchmark this? This removes this without giving checking if that was a good optimisation.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 4
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Comment-Date: Wed, 10 Dec 2025 09:32:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: plaisthos.
its_Giaan has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Patch Set 4:
(1 comment)
Patchset:
PS4:
Quoted 1 line
Did we ever benchmark this? This removes this without giving checking if that was a good optimisatio […]
Yes I did, and even though you can get a 5% performance gain it may lead to weird issues if used server side, another way could be to make the option client only.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 4
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Wed, 10 Dec 2025 09:37:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
plaisthos has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Patch Set 4: -Code-Review
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 4
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Comment-Date: Wed, 10 Dec 2025 12:10:40 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: flichtenheld.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now.
Change subject: Deprecate --fast-io option
......................................................................
Deprecate --fast-io option
Recent changes to the event loop revealed that
the --fast-io option is now partially broken and
may cause "unroutable control packet" issues.
As agreed during the last hackathon, this patch
turns --fast-io into a no-op and emits a warning
when it is used.
---
M doc/man-sections/generic-options.rst
M doc/man-sections/unsupported-options.rst
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
11 files changed, 18 insertions(+), 125 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/1425/5
doc/man-sections/generic-options.rst +0 -12
@@ -211,18 +211,6 @@ ``--show-engines`` standalone option to list the crypto engines which are supported by OpenSSL. ---fast-io - Optimize TUN/TAP/UDP I/O writes by avoiding a call to - poll/epoll/select prior to the write operation. The purpose of such a - call would normally be to block until the device or socket is ready to - accept the write. Such blocking is unnecessary on some platforms which - don't support write blocking on UDP sockets or TUN/TAP devices. In such - cases, one can optimize the event loop by avoiding the poll/epoll/select - call, improving CPU efficiency by 5% to 10%. - - This option can only be used on non-Windows systems, when ``--proto - udp`` is specified, and when ``--shaper`` is *NOT* specified. - --group group Similar to the ``--user`` option, this option changes the group ID of the OpenVPN process to ``group`` after initialization.
doc/man-sections/unsupported-options.rst +4 -0
@@ -9,6 +9,10 @@ Removed in OpenVPN 2.5. This should be replaced with ``--verify-client-cert none``. +--fast-io + Ignored since OpenVPN 2.7. This option became broken due to changes + to the event loop. + --http-proxy-retry Removed in OpenVPN 2.4. All retries are controlled by ``--max-connect-retry``.
src/openvpn/forward.c +7 -29
@@ -2154,13 +2154,12 @@ }/* -* Wait for I/O events. Used for both TCP & UDP sockets -* in point-to-point mode and for UDP sockets in +* Wait for I/O events. Used for UDP sockets in * point-to-multipoint mode. */ void -get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) +get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) {unsigned int out_socket;
@@ -2168,33 +2167,12 @@ multi_io->udp_flags = (out_socket <<SOCKET_SHIFT ); } +/* +* This is the core I/O wait function, used for all I/O waits except +* for the top-level server sockets. +*/ void -get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) -{ - multi_io->udp_flags =ES_ERROR ; -if (c->c2.fast_io && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - multi_io->udp_flags = ret; - } -else - { -/* slow path - delegate to io_wait_dowork_udp to calculate flags */ -get_io_flags_dowork_udp (c, multi_io, flags); - } -} - -void -io_wait_dowork (struct context *c,const unsigned int flags) +io_wait (struct context *c,const unsigned int flags) {unsigned int out_socket;unsigned int out_tuntap;
src/openvpn/forward.h +1 -32
@@ -68,12 +68,9 @@extern counter_type link_write_bytes_global; -void get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io, -const unsigned int flags); -void get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags); -void io_wait_dowork (struct context *c,const unsigned int flags); +void io_wait (struct context *c,const unsigned int flags);void pre_select (struct context *c);
@@ -382,34 +379,6 @@return flags; } -/* -* This is the core I/O wait function, used for all I/O waits except -* for the top-level server sockets. -*/ -static inline void -io_wait (struct context *c,const unsigned int flags) -{ -if (proto_is_dgram (c->c2.link_sockets[0 ]->info.proto) && c->c2.fast_io - && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - c->c2.event_set_status = ret; - } -else - { -/* slow path */ -io_wait_dowork (c, flags); - } -}static inline bool connection_established (struct context *c)
src/openvpn/init.c +0 -34
@@ -4139,34 +4139,6 @@ } } -/* -* Fast I/O setup. Fast I/O is an optimization which only works -* if all of the following are true: -* -* (1) The platform is not Windows -* (2) --proto udp is enabled -* (3) --shaper is disabled -*/ -static void -do_setup_fast_io (struct context *c) -{ -if (c->options.fast_io) - { -#ifdef _WIN32 -msg (M_INFO ,"NOTE: --fast-io is disabled since we are running on Windows" ); -#else -if (c->options.shaper) - { -msg (M_INFO ,"NOTE: --fast-io is disabled since we are using --shaper" ); - } -else - { - c->c2.fast_io = true; - } -#endif - } -} -static void do_signal_on_tls_errors (struct context *c) {
@@ -4513,12 +4485,6 @@ }#endif -/* should we enable fast I/O? */ -if (c->mode ==CM_P2P || c->mode ==CM_TOP ) - { -do_setup_fast_io (c); - } -/* should we throw a signal on TLS errors? */ do_signal_on_tls_errors (c);
src/openvpn/mudp.c +1 -3
@@ -339,9 +339,7 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock) {const unsigned int status = m->multi_io->udp_flags; -const unsigned int mpp_flags = m->top.c2.fast_io - ? (MPP_CONDITIONAL_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ) - : (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +const unsigned int mpp_flags = (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL );/* UDP port ready to accept write */ if (status &SOCKET_WRITE )
src/openvpn/multi.c +1 -1
@@ -3009,7 +3009,7 @@if (!IS_SIG (&mi->context) && ((flags &MPP_PRE_SELECT ) - || ((flags &MPP_CONDITIONAL_PRE_SELECT ) && !ANY_OUT (&mi->context)))) + || (!ANY_OUT (&mi->context)))) {#if defined(ENABLE_ASYNC_PUSH )bool was_unauthenticated = true;
src/openvpn/multi.h +3 -4
@@ -271,10 +271,9 @@bool multi_process_timeout (struct multi_context *m,const unsigned int mpp_flags); -#define MPP_PRE_SELECT (1 << 0) -#define MPP_CONDITIONAL_PRE_SELECT (1 << 1) -#define MPP_CLOSE_ON_SIGNAL (1 << 2) -#define MPP_RECORD_TOUCH (1 << 3) +#define MPP_PRE_SELECT (1 << 0) +#define MPP_CLOSE_ON_SIGNAL (1 << 1) +#define MPP_RECORD_TOUCH (1 << 2)/**************************************************************************/
src/openvpn/openvpn.h +0 -3
@@ -420,9 +420,6 @@struct env_set *es;bool es_owned; -/* don't wait for TUN/TAP/UDP to be ready to accept write */ -bool fast_io; -/* --ifconfig endpoints to be pushed to client */ bool push_request_received;bool push_ifconfig_defined;
src/openvpn/options.c +1 -4
@@ -285,7 +285,6 @@#if ENABLE_IP_PKTINFO "--multihome : Configure a multi-homed UDP server.\n"#endif -"--fast-io : Optimize TUN/TAP/UDP writes.\n" "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n" "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
@@ -1795,8 +1794,6 @@#endif SHOW_INT (sockflags); -SHOW_BOOL (fast_io); -SHOW_INT (comp.alg);SHOW_INT (comp.flags);
@@ -6592,7 +6589,7 @@else if (streq (p[0 ],"fast-io" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL ); - options->fast_io = true; +msg (M_WARN ,"DEPRECATED OPTION: --fast-io option ignored." ); }else if (streq (p[0 ],"inactive" ) && p[1 ] && !p[3 ]) {
src/openvpn/options.h +0 -3
@@ -406,9 +406,6 @@int status_file_version;int status_file_update_freq; -/* optimize TUN/TAP/UDP writes */ -bool fast_io; -struct compress_options comp;/* buffer sizes */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 5
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
to look at the new patch set (#6).
Change subject: Deprecate --fast-io option
......................................................................
Deprecate --fast-io option
Recent changes to the event loop revealed that
the --fast-io option is now partially broken and
may cause "unroutable control packet" issues.
As agreed during the last hackathon, this patch
turns --fast-io into a no-op and emits a warning
when it is used.
Additionally, the MPP_CONDITIONAL_PRE_SELECT
flag has been removed as it was part of the
same code path and no longer needed.
---
M doc/man-sections/generic-options.rst
M doc/man-sections/unsupported-options.rst
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
11 files changed, 18 insertions(+), 126 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/1425/6
doc/man-sections/generic-options.rst +0 -12
@@ -211,18 +211,6 @@ ``--show-engines`` standalone option to list the crypto engines which are supported by OpenSSL. ---fast-io - Optimize TUN/TAP/UDP I/O writes by avoiding a call to - poll/epoll/select prior to the write operation. The purpose of such a - call would normally be to block until the device or socket is ready to - accept the write. Such blocking is unnecessary on some platforms which - don't support write blocking on UDP sockets or TUN/TAP devices. In such - cases, one can optimize the event loop by avoiding the poll/epoll/select - call, improving CPU efficiency by 5% to 10%. - - This option can only be used on non-Windows systems, when ``--proto - udp`` is specified, and when ``--shaper`` is *NOT* specified. - --group group Similar to the ``--user`` option, this option changes the group ID of the OpenVPN process to ``group`` after initialization.
doc/man-sections/unsupported-options.rst +4 -0
@@ -9,6 +9,10 @@ Removed in OpenVPN 2.5. This should be replaced with ``--verify-client-cert none``. +--fast-io + Ignored since OpenVPN 2.7. This option became broken due to changes + to the event loop. + --http-proxy-retry Removed in OpenVPN 2.4. All retries are controlled by ``--max-connect-retry``.
src/openvpn/forward.c +7 -29
@@ -2154,13 +2154,12 @@ }/* -* Wait for I/O events. Used for both TCP & UDP sockets -* in point-to-point mode and for UDP sockets in +* Wait for I/O events. Used for UDP sockets in * point-to-multipoint mode. */ void -get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) +get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) {unsigned int out_socket;
@@ -2168,33 +2167,12 @@ multi_io->udp_flags = (out_socket <<SOCKET_SHIFT ); } +/* +* This is the core I/O wait function, used for all I/O waits except +* for the top-level server sockets. +*/ void -get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) -{ - multi_io->udp_flags =ES_ERROR ; -if (c->c2.fast_io && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - multi_io->udp_flags = ret; - } -else - { -/* slow path - delegate to io_wait_dowork_udp to calculate flags */ -get_io_flags_dowork_udp (c, multi_io, flags); - } -} - -void -io_wait_dowork (struct context *c,const unsigned int flags) +io_wait (struct context *c,const unsigned int flags) {unsigned int out_socket;unsigned int out_tuntap;
src/openvpn/forward.h +1 -32
@@ -68,12 +68,9 @@extern counter_type link_write_bytes_global; -void get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io, -const unsigned int flags); -void get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags); -void io_wait_dowork (struct context *c,const unsigned int flags); +void io_wait (struct context *c,const unsigned int flags);void pre_select (struct context *c);
@@ -382,34 +379,6 @@return flags; } -/* -* This is the core I/O wait function, used for all I/O waits except -* for the top-level server sockets. -*/ -static inline void -io_wait (struct context *c,const unsigned int flags) -{ -if (proto_is_dgram (c->c2.link_sockets[0 ]->info.proto) && c->c2.fast_io - && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - c->c2.event_set_status = ret; - } -else - { -/* slow path */ -io_wait_dowork (c, flags); - } -}static inline bool connection_established (struct context *c)
src/openvpn/init.c +0 -34
@@ -4139,34 +4139,6 @@ } } -/* -* Fast I/O setup. Fast I/O is an optimization which only works -* if all of the following are true: -* -* (1) The platform is not Windows -* (2) --proto udp is enabled -* (3) --shaper is disabled -*/ -static void -do_setup_fast_io (struct context *c) -{ -if (c->options.fast_io) - { -#ifdef _WIN32 -msg (M_INFO ,"NOTE: --fast-io is disabled since we are running on Windows" ); -#else -if (c->options.shaper) - { -msg (M_INFO ,"NOTE: --fast-io is disabled since we are using --shaper" ); - } -else - { - c->c2.fast_io = true; - } -#endif - } -} -static void do_signal_on_tls_errors (struct context *c) {
@@ -4513,12 +4485,6 @@ }#endif -/* should we enable fast I/O? */ -if (c->mode ==CM_P2P || c->mode ==CM_TOP ) - { -do_setup_fast_io (c); - } -/* should we throw a signal on TLS errors? */ do_signal_on_tls_errors (c);
src/openvpn/mudp.c +1 -3
@@ -339,9 +339,7 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock) {const unsigned int status = m->multi_io->udp_flags; -const unsigned int mpp_flags = m->top.c2.fast_io - ? (MPP_CONDITIONAL_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ) - : (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +const unsigned int mpp_flags = (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL );/* UDP port ready to accept write */ if (status &SOCKET_WRITE )
src/openvpn/multi.c +1 -2
@@ -3008,8 +3008,7 @@bool ret = true;if (!IS_SIG (&mi->context) - && ((flags &MPP_PRE_SELECT ) - || ((flags &MPP_CONDITIONAL_PRE_SELECT ) && !ANY_OUT (&mi->context)))) + && ((flags &MPP_PRE_SELECT ))) {#if defined(ENABLE_ASYNC_PUSH )bool was_unauthenticated = true;
src/openvpn/multi.h +3 -4
@@ -271,10 +271,9 @@bool multi_process_timeout (struct multi_context *m,const unsigned int mpp_flags); -#define MPP_PRE_SELECT (1 << 0) -#define MPP_CONDITIONAL_PRE_SELECT (1 << 1) -#define MPP_CLOSE_ON_SIGNAL (1 << 2) -#define MPP_RECORD_TOUCH (1 << 3) +#define MPP_PRE_SELECT (1 << 0) +#define MPP_CLOSE_ON_SIGNAL (1 << 1) +#define MPP_RECORD_TOUCH (1 << 2)/**************************************************************************/
src/openvpn/openvpn.h +0 -3
@@ -420,9 +420,6 @@struct env_set *es;bool es_owned; -/* don't wait for TUN/TAP/UDP to be ready to accept write */ -bool fast_io; -/* --ifconfig endpoints to be pushed to client */ bool push_request_received;bool push_ifconfig_defined;
src/openvpn/options.c +1 -4
@@ -285,7 +285,6 @@#if ENABLE_IP_PKTINFO "--multihome : Configure a multi-homed UDP server.\n"#endif -"--fast-io : Optimize TUN/TAP/UDP writes.\n" "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n" "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
@@ -1795,8 +1794,6 @@#endif SHOW_INT (sockflags); -SHOW_BOOL (fast_io); -SHOW_INT (comp.alg);SHOW_INT (comp.flags);
@@ -6592,7 +6589,7 @@else if (streq (p[0 ],"fast-io" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL ); - options->fast_io = true; +msg (M_WARN ,"DEPRECATED OPTION: --fast-io option ignored." ); }else if (streq (p[0 ],"inactive" ) && p[1 ] && !p[3 ]) {
src/openvpn/options.h +0 -3
@@ -406,9 +406,6 @@int status_file_version;int status_file_update_freq; -/* optimize TUN/TAP/UDP writes */ -bool fast_io; -struct compress_options comp;/* buffer sizes */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 6
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld, its_Giaan.
cron2 has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Patch Set 6: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 6
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 11 Dec 2025 10:59:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v6 1/1 Deprecate --fast-io option
In reply to a message not in the archiveFrom: Gianmarco De Gregori <[email protected]...>
Recent changes to the event loop revealed that
the --fast-io option is now partially broken and
may cause "unroutable control packet" issues.
As agreed during the last hackathon, this patch
turns --fast-io into a no-op and emits a warning
when it is used.
Additionally, the MPP_CONDITIONAL_PRE_SELECT
flag has been removed as it was part of the
same code path and no longer needed.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1425
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1425
This mail reflects revision 6 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
doc/man-sections/generic-options.rst +0 -12
@@ -211,18 +211,6 @@ ``--show-engines`` standalone option to list the crypto engines which are supported by OpenSSL. ---fast-io - Optimize TUN/TAP/UDP I/O writes by avoiding a call to - poll/epoll/select prior to the write operation. The purpose of such a - call would normally be to block until the device or socket is ready to - accept the write. Such blocking is unnecessary on some platforms which - don't support write blocking on UDP sockets or TUN/TAP devices. In such - cases, one can optimize the event loop by avoiding the poll/epoll/select - call, improving CPU efficiency by 5% to 10%. - - This option can only be used on non-Windows systems, when ``--proto - udp`` is specified, and when ``--shaper`` is *NOT* specified. - --group group Similar to the ``--user`` option, this option changes the group ID of the OpenVPN process to ``group`` after initialization.
doc/man-sections/unsupported-options.rst +4 -0
@@ -9,6 +9,10 @@ Removed in OpenVPN 2.5. This should be replaced with ``--verify-client-cert none``. +--fast-io + Ignored since OpenVPN 2.7. This option became broken due to changes + to the event loop. + --http-proxy-retry Removed in OpenVPN 2.4. All retries are controlled by ``--max-connect-retry``.
src/openvpn/forward.c +7 -29
@@ -2154,13 +2154,12 @@ }/* -* Wait for I/O events. Used for both TCP & UDP sockets -* in point-to-point mode and for UDP sockets in +* Wait for I/O events. Used for UDP sockets in * point-to-multipoint mode. */ void -get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) +get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) {unsigned int out_socket;
@@ -2168,33 +2167,12 @@ multi_io->udp_flags = (out_socket <<SOCKET_SHIFT ); } +/* +* This is the core I/O wait function, used for all I/O waits except +* for the top-level server sockets. +*/ void -get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) -{ - multi_io->udp_flags =ES_ERROR ; -if (c->c2.fast_io && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - multi_io->udp_flags = ret; - } -else - { -/* slow path - delegate to io_wait_dowork_udp to calculate flags */ -get_io_flags_dowork_udp (c, multi_io, flags); - } -} - -void -io_wait_dowork (struct context *c,const unsigned int flags) +io_wait (struct context *c,const unsigned int flags) {unsigned int out_socket;unsigned int out_tuntap;
src/openvpn/forward.h +1 -32
@@ -68,12 +68,9 @@extern counter_type link_write_bytes_global; -void get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io, -const unsigned int flags); -void get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags); -void io_wait_dowork (struct context *c,const unsigned int flags); +void io_wait (struct context *c,const unsigned int flags);void pre_select (struct context *c);
@@ -382,34 +379,6 @@return flags; } -/* -* This is the core I/O wait function, used for all I/O waits except -* for the top-level server sockets. -*/ -static inline void -io_wait (struct context *c,const unsigned int flags) -{ -if (proto_is_dgram (c->c2.link_sockets[0 ]->info.proto) && c->c2.fast_io - && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - c->c2.event_set_status = ret; - } -else - { -/* slow path */ -io_wait_dowork (c, flags); - } -}static inline bool connection_established (struct context *c)
src/openvpn/init.c +0 -34
@@ -4139,34 +4139,6 @@ } } -/* -* Fast I/O setup. Fast I/O is an optimization which only works -* if all of the following are true: -* -* (1) The platform is not Windows -* (2) --proto udp is enabled -* (3) --shaper is disabled -*/ -static void -do_setup_fast_io (struct context *c) -{ -if (c->options.fast_io) - { -#ifdef _WIN32 -msg (M_INFO ,"NOTE: --fast-io is disabled since we are running on Windows" ); -#else -if (c->options.shaper) - { -msg (M_INFO ,"NOTE: --fast-io is disabled since we are using --shaper" ); - } -else - { - c->c2.fast_io = true; - } -#endif - } -} -static void do_signal_on_tls_errors (struct context *c) {
@@ -4513,12 +4485,6 @@ }#endif -/* should we enable fast I/O? */ -if (c->mode ==CM_P2P || c->mode ==CM_TOP ) - { -do_setup_fast_io (c); - } -/* should we throw a signal on TLS errors? */ do_signal_on_tls_errors (c);
src/openvpn/mudp.c +1 -3
@@ -339,9 +339,7 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock) {const unsigned int status = m->multi_io->udp_flags; -const unsigned int mpp_flags = m->top.c2.fast_io - ? (MPP_CONDITIONAL_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ) - : (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +const unsigned int mpp_flags = (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL );/* UDP port ready to accept write */ if (status &SOCKET_WRITE )
src/openvpn/multi.c +1 -2
@@ -3008,8 +3008,7 @@bool ret = true;if (!IS_SIG (&mi->context) - && ((flags &MPP_PRE_SELECT ) - || ((flags &MPP_CONDITIONAL_PRE_SELECT ) && !ANY_OUT (&mi->context)))) + && ((flags &MPP_PRE_SELECT ))) {#if defined(ENABLE_ASYNC_PUSH )bool was_unauthenticated = true;
src/openvpn/multi.h +3 -4
@@ -271,10 +271,9 @@bool multi_process_timeout (struct multi_context *m,const unsigned int mpp_flags); -#define MPP_PRE_SELECT (1 << 0) -#define MPP_CONDITIONAL_PRE_SELECT (1 << 1) -#define MPP_CLOSE_ON_SIGNAL (1 << 2) -#define MPP_RECORD_TOUCH (1 << 3) +#define MPP_PRE_SELECT (1 << 0) +#define MPP_CLOSE_ON_SIGNAL (1 << 1) +#define MPP_RECORD_TOUCH (1 << 2)/**************************************************************************/
src/openvpn/openvpn.h +0 -3
@@ -420,9 +420,6 @@struct env_set *es;bool es_owned; -/* don't wait for TUN/TAP/UDP to be ready to accept write */ -bool fast_io; -/* --ifconfig endpoints to be pushed to client */ bool push_request_received;bool push_ifconfig_defined;
src/openvpn/options.c +1 -4
@@ -285,7 +285,6 @@#if ENABLE_IP_PKTINFO "--multihome : Configure a multi-homed UDP server.\n"#endif -"--fast-io : Optimize TUN/TAP/UDP writes.\n" "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n" "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
@@ -1795,8 +1794,6 @@#endif SHOW_INT (sockflags); -SHOW_BOOL (fast_io); -SHOW_INT (comp.alg);SHOW_INT (comp.flags);
@@ -6592,7 +6589,7 @@else if (streq (p[0 ],"fast-io" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL ); - options->fast_io = true; +msg (M_WARN ,"DEPRECATED OPTION: --fast-io option ignored." ); }else if (streq (p[0 ],"inactive" ) && p[1 ] && !p[3 ]) {
src/openvpn/options.h +0 -3
@@ -406,9 +406,6 @@int status_file_version;int status_file_update_freq; -/* optimize TUN/TAP/UDP writes */ -bool fast_io; -struct compress_options comp;/* buffer sizes */
[Openvpn-devel] [PATCH applied] Re: Deprecate --fast-io option
So we had quite a bit of discussion on this - how much difference does it make (~5%), is it worth it, ... - and the result of that was "it is not working correctly due to multisocket patchset fallout" and "the event code around UDP is way too complex and nobody understands it anymore".
So removing --fast-io simplifies quite a bit of the complicated event stuff (and after 2.7.0 release we can have a new look on how to make this more efficient in the light of "multiple sockets to deal with" - a GH issue has already been opened on this so we won't forget).
I have stared long and hard at the changes, and run the full set of client and server tests on "linux without DCO" and "linux with DCO". Especially the first set also has async scripts/plugins, inotify, and all that - and everything still works. So in it goes :-)
Your patch has been applied to the master branch.
commit e5ff824753a7ebeb1cf78f1f0d86f3790eff83e6
Author: Gianmarco De Gregori Date: Thu Dec 11 11:59:51 2025 +0100
Deprecate --fast-io option
Signed-off-by: Gianmarco De Gregori <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1425
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35024.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#7) to the change originally created by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: Deprecate --fast-io option
......................................................................
Deprecate --fast-io option
Recent changes to the event loop revealed that
the --fast-io option is now partially broken and
may cause "unroutable control packet" issues.
As agreed during the last hackathon, this patch
turns --fast-io into a no-op and emits a warning
when it is used.
Additionally, the MPP_CONDITIONAL_PRE_SELECT
flag has been removed as it was part of the
same code path and no longer needed.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1425
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35024.html
---
M doc/man-sections/generic-options.rst
M doc/man-sections/unsupported-options.rst
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
11 files changed, 18 insertions(+), 126 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/1425/7
doc/man-sections/generic-options.rst +0 -12
@@ -211,18 +211,6 @@ ``--show-engines`` standalone option to list the crypto engines which are supported by OpenSSL. ---fast-io - Optimize TUN/TAP/UDP I/O writes by avoiding a call to - poll/epoll/select prior to the write operation. The purpose of such a - call would normally be to block until the device or socket is ready to - accept the write. Such blocking is unnecessary on some platforms which - don't support write blocking on UDP sockets or TUN/TAP devices. In such - cases, one can optimize the event loop by avoiding the poll/epoll/select - call, improving CPU efficiency by 5% to 10%. - - This option can only be used on non-Windows systems, when ``--proto - udp`` is specified, and when ``--shaper`` is *NOT* specified. - --group group Similar to the ``--user`` option, this option changes the group ID of the OpenVPN process to ``group`` after initialization.
doc/man-sections/unsupported-options.rst +4 -0
@@ -9,6 +9,10 @@ Removed in OpenVPN 2.5. This should be replaced with ``--verify-client-cert none``. +--fast-io + Ignored since OpenVPN 2.7. This option became broken due to changes + to the event loop. + --http-proxy-retry Removed in OpenVPN 2.4. All retries are controlled by ``--max-connect-retry``.
src/openvpn/forward.c +7 -29
@@ -2154,13 +2154,12 @@ }/* -* Wait for I/O events. Used for both TCP & UDP sockets -* in point-to-point mode and for UDP sockets in +* Wait for I/O events. Used for UDP sockets in * point-to-multipoint mode. */ void -get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) +get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) {unsigned int out_socket;
@@ -2168,33 +2167,12 @@ multi_io->udp_flags = (out_socket <<SOCKET_SHIFT ); } +/* +* This is the core I/O wait function, used for all I/O waits except +* for the top-level server sockets. +*/ void -get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) -{ - multi_io->udp_flags =ES_ERROR ; -if (c->c2.fast_io && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - multi_io->udp_flags = ret; - } -else - { -/* slow path - delegate to io_wait_dowork_udp to calculate flags */ -get_io_flags_dowork_udp (c, multi_io, flags); - } -} - -void -io_wait_dowork (struct context *c,const unsigned int flags) +io_wait (struct context *c,const unsigned int flags) {unsigned int out_socket;unsigned int out_tuntap;
src/openvpn/forward.h +1 -32
@@ -68,12 +68,9 @@extern counter_type link_write_bytes_global; -void get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io, -const unsigned int flags); -void get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags); -void io_wait_dowork (struct context *c,const unsigned int flags); +void io_wait (struct context *c,const unsigned int flags);void pre_select (struct context *c);
@@ -382,34 +379,6 @@return flags; } -/* -* This is the core I/O wait function, used for all I/O waits except -* for the top-level server sockets. -*/ -static inline void -io_wait (struct context *c,const unsigned int flags) -{ -if (proto_is_dgram (c->c2.link_sockets[0 ]->info.proto) && c->c2.fast_io - && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - c->c2.event_set_status = ret; - } -else - { -/* slow path */ -io_wait_dowork (c, flags); - } -}static inline bool connection_established (struct context *c)
src/openvpn/init.c +0 -34
@@ -4139,34 +4139,6 @@ } } -/* -* Fast I/O setup. Fast I/O is an optimization which only works -* if all of the following are true: -* -* (1) The platform is not Windows -* (2) --proto udp is enabled -* (3) --shaper is disabled -*/ -static void -do_setup_fast_io (struct context *c) -{ -if (c->options.fast_io) - { -#ifdef _WIN32 -msg (M_INFO ,"NOTE: --fast-io is disabled since we are running on Windows" ); -#else -if (c->options.shaper) - { -msg (M_INFO ,"NOTE: --fast-io is disabled since we are using --shaper" ); - } -else - { - c->c2.fast_io = true; - } -#endif - } -} -static void do_signal_on_tls_errors (struct context *c) {
@@ -4513,12 +4485,6 @@ }#endif -/* should we enable fast I/O? */ -if (c->mode ==CM_P2P || c->mode ==CM_TOP ) - { -do_setup_fast_io (c); - } -/* should we throw a signal on TLS errors? */ do_signal_on_tls_errors (c);
src/openvpn/mudp.c +1 -3
@@ -339,9 +339,7 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock) {const unsigned int status = m->multi_io->udp_flags; -const unsigned int mpp_flags = m->top.c2.fast_io - ? (MPP_CONDITIONAL_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ) - : (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +const unsigned int mpp_flags = (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL );/* UDP port ready to accept write */ if (status &SOCKET_WRITE )
src/openvpn/multi.c +1 -2
@@ -3008,8 +3008,7 @@bool ret = true;if (!IS_SIG (&mi->context) - && ((flags &MPP_PRE_SELECT ) - || ((flags &MPP_CONDITIONAL_PRE_SELECT ) && !ANY_OUT (&mi->context)))) + && ((flags &MPP_PRE_SELECT ))) {#if defined(ENABLE_ASYNC_PUSH )bool was_unauthenticated = true;
src/openvpn/multi.h +3 -4
@@ -271,10 +271,9 @@bool multi_process_timeout (struct multi_context *m,const unsigned int mpp_flags); -#define MPP_PRE_SELECT (1 << 0) -#define MPP_CONDITIONAL_PRE_SELECT (1 << 1) -#define MPP_CLOSE_ON_SIGNAL (1 << 2) -#define MPP_RECORD_TOUCH (1 << 3) +#define MPP_PRE_SELECT (1 << 0) +#define MPP_CLOSE_ON_SIGNAL (1 << 1) +#define MPP_RECORD_TOUCH (1 << 2)/**************************************************************************/
src/openvpn/openvpn.h +0 -3
@@ -420,9 +420,6 @@struct env_set *es;bool es_owned; -/* don't wait for TUN/TAP/UDP to be ready to accept write */ -bool fast_io; -/* --ifconfig endpoints to be pushed to client */ bool push_request_received;bool push_ifconfig_defined;
src/openvpn/options.c +1 -4
@@ -285,7 +285,6 @@#if ENABLE_IP_PKTINFO "--multihome : Configure a multi-homed UDP server.\n"#endif -"--fast-io : Optimize TUN/TAP/UDP writes.\n" "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n" "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
@@ -1795,8 +1794,6 @@#endif SHOW_INT (sockflags); -SHOW_BOOL (fast_io); -SHOW_INT (comp.alg);SHOW_INT (comp.flags);
@@ -6592,7 +6589,7 @@else if (streq (p[0 ],"fast-io" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL ); - options->fast_io = true; +msg (M_WARN ,"DEPRECATED OPTION: --fast-io option ignored." ); }else if (streq (p[0 ],"inactive" ) && p[1 ] && !p[3 ]) {
src/openvpn/options.h +0 -3
@@ -406,9 +406,6 @@int status_file_version;int status_file_update_freq; -/* optimize TUN/TAP/UDP writes */ -bool fast_io; -struct compress_options comp;/* buffer sizes */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 7
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email )
Change subject: Deprecate --fast-io option
......................................................................
Deprecate --fast-io option
Recent changes to the event loop revealed that
the --fast-io option is now partially broken and
may cause "unroutable control packet" issues.
As agreed during the last hackathon, this patch
turns --fast-io into a no-op and emits a warning
when it is used.
Additionally, the MPP_CONDITIONAL_PRE_SELECT
flag has been removed as it was part of the
same code path and no longer needed.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1425
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35024.html
---
M doc/man-sections/generic-options.rst
M doc/man-sections/unsupported-options.rst
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/init.c
M src/openvpn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/openvpn.h
M src/openvpn/options.c
M src/openvpn/options.h
11 files changed, 18 insertions(+), 126 deletions(-)
doc/man-sections/generic-options.rst +0 -12
@@ -211,18 +211,6 @@ ``--show-engines`` standalone option to list the crypto engines which are supported by OpenSSL. ---fast-io - Optimize TUN/TAP/UDP I/O writes by avoiding a call to - poll/epoll/select prior to the write operation. The purpose of such a - call would normally be to block until the device or socket is ready to - accept the write. Such blocking is unnecessary on some platforms which - don't support write blocking on UDP sockets or TUN/TAP devices. In such - cases, one can optimize the event loop by avoiding the poll/epoll/select - call, improving CPU efficiency by 5% to 10%. - - This option can only be used on non-Windows systems, when ``--proto - udp`` is specified, and when ``--shaper`` is *NOT* specified. - --group group Similar to the ``--user`` option, this option changes the group ID of the OpenVPN process to ``group`` after initialization.
doc/man-sections/unsupported-options.rst +4 -0
@@ -9,6 +9,10 @@ Removed in OpenVPN 2.5. This should be replaced with ``--verify-client-cert none``. +--fast-io + Ignored since OpenVPN 2.7. This option became broken due to changes + to the event loop. + --http-proxy-retry Removed in OpenVPN 2.4. All retries are controlled by ``--max-connect-retry``.
src/openvpn/forward.c +7 -29
@@ -2154,13 +2154,12 @@ }/* -* Wait for I/O events. Used for both TCP & UDP sockets -* in point-to-point mode and for UDP sockets in +* Wait for I/O events. Used for UDP sockets in * point-to-multipoint mode. */ void -get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) +get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) {unsigned int out_socket;
@@ -2168,33 +2167,12 @@ multi_io->udp_flags = (out_socket <<SOCKET_SHIFT ); } +/* +* This is the core I/O wait function, used for all I/O waits except +* for the top-level server sockets. +*/ void -get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags) -{ - multi_io->udp_flags =ES_ERROR ; -if (c->c2.fast_io && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - multi_io->udp_flags = ret; - } -else - { -/* slow path - delegate to io_wait_dowork_udp to calculate flags */ -get_io_flags_dowork_udp (c, multi_io, flags); - } -} - -void -io_wait_dowork (struct context *c,const unsigned int flags) +io_wait (struct context *c,const unsigned int flags) {unsigned int out_socket;unsigned int out_tuntap;
src/openvpn/forward.h +1 -32
@@ -68,12 +68,9 @@extern counter_type link_write_bytes_global; -void get_io_flags_dowork_udp (struct context *c,struct multi_io *multi_io, -const unsigned int flags); -void get_io_flags_udp (struct context *c,struct multi_io *multi_io,const unsigned int flags); -void io_wait_dowork (struct context *c,const unsigned int flags); +void io_wait (struct context *c,const unsigned int flags);void pre_select (struct context *c);
@@ -382,34 +379,6 @@return flags; } -/* -* This is the core I/O wait function, used for all I/O waits except -* for the top-level server sockets. -*/ -static inline void -io_wait (struct context *c,const unsigned int flags) -{ -if (proto_is_dgram (c->c2.link_sockets[0 ]->info.proto) && c->c2.fast_io - && (flags & (IOW_TO_TUN |IOW_TO_LINK |IOW_MBUF ))) - { -/* fast path -- only for TUN/TAP/UDP writes */ -unsigned int ret =0 ; -if (flags &IOW_TO_TUN ) - { - ret |=TUN_WRITE ; - } -if (flags & (IOW_TO_LINK |IOW_MBUF )) - { - ret |=SOCKET_WRITE ; - } - c->c2.event_set_status = ret; - } -else - { -/* slow path */ -io_wait_dowork (c, flags); - } -}static inline bool connection_established (struct context *c)
src/openvpn/init.c +0 -34
@@ -4139,34 +4139,6 @@ } } -/* -* Fast I/O setup. Fast I/O is an optimization which only works -* if all of the following are true: -* -* (1) The platform is not Windows -* (2) --proto udp is enabled -* (3) --shaper is disabled -*/ -static void -do_setup_fast_io (struct context *c) -{ -if (c->options.fast_io) - { -#ifdef _WIN32 -msg (M_INFO ,"NOTE: --fast-io is disabled since we are running on Windows" ); -#else -if (c->options.shaper) - { -msg (M_INFO ,"NOTE: --fast-io is disabled since we are using --shaper" ); - } -else - { - c->c2.fast_io = true; - } -#endif - } -} -static void do_signal_on_tls_errors (struct context *c) {
@@ -4513,12 +4485,6 @@ }#endif -/* should we enable fast I/O? */ -if (c->mode ==CM_P2P || c->mode ==CM_TOP ) - { -do_setup_fast_io (c); - } -/* should we throw a signal on TLS errors? */ do_signal_on_tls_errors (c);
src/openvpn/mudp.c +1 -3
@@ -339,9 +339,7 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock) {const unsigned int status = m->multi_io->udp_flags; -const unsigned int mpp_flags = m->top.c2.fast_io - ? (MPP_CONDITIONAL_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ) - : (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +const unsigned int mpp_flags = (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL );/* UDP port ready to accept write */ if (status &SOCKET_WRITE )
src/openvpn/multi.c +1 -2
@@ -3008,8 +3008,7 @@bool ret = true;if (!IS_SIG (&mi->context) - && ((flags &MPP_PRE_SELECT ) - || ((flags &MPP_CONDITIONAL_PRE_SELECT ) && !ANY_OUT (&mi->context)))) + && ((flags &MPP_PRE_SELECT ))) {#if defined(ENABLE_ASYNC_PUSH )bool was_unauthenticated = true;
src/openvpn/multi.h +3 -4
@@ -271,10 +271,9 @@bool multi_process_timeout (struct multi_context *m,const unsigned int mpp_flags); -#define MPP_PRE_SELECT (1 << 0) -#define MPP_CONDITIONAL_PRE_SELECT (1 << 1) -#define MPP_CLOSE_ON_SIGNAL (1 << 2) -#define MPP_RECORD_TOUCH (1 << 3) +#define MPP_PRE_SELECT (1 << 0) +#define MPP_CLOSE_ON_SIGNAL (1 << 1) +#define MPP_RECORD_TOUCH (1 << 2)/**************************************************************************/
src/openvpn/openvpn.h +0 -3
@@ -420,9 +420,6 @@struct env_set *es;bool es_owned; -/* don't wait for TUN/TAP/UDP to be ready to accept write */ -bool fast_io; -/* --ifconfig endpoints to be pushed to client */ bool push_request_received;bool push_ifconfig_defined;
src/openvpn/options.c +1 -4
@@ -285,7 +285,6 @@#if ENABLE_IP_PKTINFO "--multihome : Configure a multi-homed UDP server.\n"#endif -"--fast-io : Optimize TUN/TAP/UDP writes.\n" "--remap-usr1 s : On SIGUSR1 signals, remap signal (s='SIGHUP' or 'SIGTERM').\n" "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-restart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-restart.\n"
@@ -1795,8 +1794,6 @@#endif SHOW_INT (sockflags); -SHOW_BOOL (fast_io); -SHOW_INT (comp.alg);SHOW_INT (comp.flags);
@@ -6592,7 +6589,7 @@else if (streq (p[0 ],"fast-io" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL ); - options->fast_io = true; +msg (M_WARN ,"DEPRECATED OPTION: --fast-io option ignored." ); }else if (streq (p[0 ],"inactive" ) && p[1 ] && !p[3 ]) {
src/openvpn/options.h +0 -3
@@ -406,9 +406,6 @@int status_file_version;int status_file_update_freq; -/* optimize TUN/TAP/UDP writes */ -bool fast_io; -struct compress_options comp;/* buffer sizes */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 7
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>